package com.ruoyi.web.controller.common;

import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.encrypt.utils.RSAUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 验证码操作处理
 * 
 * @author ruoyi
 */
@RestController
public class EncryParamsController
{
    /**
     * 获取RSA公钥（前端初始化用）
     */
    @GetMapping("/rsa/publicKey")
    public AjaxResult getPublicKey() throws Exception {
        Map<String,Object> result = new HashMap<>();
        result.put("PK",RSAUtils.getPublicKey());
        result.put("isEncryReqParams",RuoYiConfig.isEncryReqParams());
        return AjaxResult.success("获取成功",result);
    }
}
